package cn.iocoder.yudao.module.ad.order.controller.admin;

import cn.iocoder.yudao.framework.business.basic.controller.DetailController;
import cn.iocoder.yudao.framework.business.basic.controller.PageController;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.ad.order.service.AdminAdPlanOrderService;
import cn.iocoder.yudao.module.ad.order.vo.AdminAdPlanOrderQueryDTO;
import cn.iocoder.yudao.module.ad.order.vo.AdminAdPlanOrderVO;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 广告投放订单")
@RestController
@RequestMapping("/ad/plan-order")
@Validated
public class AdPlanOrderController implements DetailController<AdminAdPlanOrderVO, Long>, PageController<AdminAdPlanOrderVO, AdminAdPlanOrderQueryDTO> {
    @Resource
    private AdminAdPlanOrderService adminAdPlanOrderService;

    @PreAuthorize("@ss.hasPermission('ad:plan:order')")
    @Override
    public CommonResult<AdminAdPlanOrderVO> getDetail(Long id) {
        return success(adminAdPlanOrderService.getDetail(id));
    }

    @PreAuthorize("@ss.hasPermission('ad:plan:order')")
    @Override
    public CommonResult<PageResult<AdminAdPlanOrderVO>> getPage(Integer pageNo, Integer pageSize, AdminAdPlanOrderQueryDTO param) {
        return success(adminAdPlanOrderService.getPage(pageNo, pageSize, param));
    }

}